import sympy as sym
import numpy as np


def logical(expr):
    # SymPy simplified the expr already
    if isinstance(expr, (list, np.ndarray)):
        narr = np.array(expr)
        exprs = np.reshape(narr, (narr.size,))
        for idx in range(exprs.size):
            exprs[idx] = logical(exprs[idx])
        return exprs.reshape(narr.shape)
    else:
        result = sym.simplify(expr)
        return result if result.is_Boolean else False


# Test case 1: Input is symbolic expressions
x = sym.symbols('x')
expr = sym.Ge(sym.Abs(x), 0)
assert logical(expr) == True

expr = sym.Eq(sym.Abs(x),x)
assert logical(expr) == False

expr = sym.Eq(sym.log(x) ,x)
assert logical(expr) == False

# Test case 2: Input is 2 dim symbolic expressions
x = sym.symbols('x')
arr = [
    [sym.Ne(x ,x+1), sym.Ge(abs(x) ,0) , sym.Eq(x ,x)],
    [sym.Eq(x ,x+1), sym.Eq(abs(x) ,0) , sym.Eq(x ,x)]
    ]
result = np.array([
    [True, True, True],
    [False, False, True]
])
assert np.array_equal(logical(arr), result)
